package task.nms;

import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;

public class ResetRootPasswd extends NmsTask {

	@Override
	public void doRun(Map<String, String> propMap) throws SQLException {
		String schema = propMap.get("schema");
		String sql = String.format("update %s.core_security_user set passw='GpHWL3ymc5liWkNopqtdSjuqYHM=' where account='root'", schema);
		Statement stmt = conn().createStatement();
		stmt.execute(sql);
		int n = stmt.getUpdateCount();
		System.out.printf("%s row(s) in %s.core_security_user reset%n",n, schema);
	}
	@Override
	public String[] propertyNames() {
		String[] props = { "schema" };
		return props;
	}
	@Override
	public String getDescription() {
		String desc = "Reset the root passwd to pw";
		return desc;
	}

}
